App({
  globalData: {
    /*
     *默认主题颜色
     */
    normalSkin: {
      fontColor:'#000000',
      backgroundColor:'#ffffff',
      skinColor:'#000000'
    },
    isiPhoneX: 0//iphone x 系列手机
  },
  onLaunch: function () {
    wx.hideTabBar();
    let that = this;
    wx.getSystemInfo({
        success: function (res) {
            if (res.model.indexOf(res.model=="iPhone X") > -1 || res.model.indexOf("iPhone XR") > -1 || res.model.indexOf("iPhone XS Max") > -1) {
                that.globalData.isiPhoneX = 1;
            }
        }
    })
  },
  setThemeSkin:function(that,callback){
    let _this = this;
    wx.getStorage({
      key: 'skin',
        success: function(res) {
          if(res){
            let skinObj = res.data == null ? _this.globalData.normalSkin : res.data;
            that.setData({
              fontColor: skinObj.fontColor,
              backgroundColor: skinObj.backgroundColor,
              skinColor: skinObj.skinColor
            })
        
            wx.setNavigationBarColor({
              frontColor: skinObj.fontColor,
              backgroundColor: skinObj.backgroundColor,
            })
            if(callback != undefined && typeof callback == "function" ){
                callback(skinObj);
            }
          }
        },fail: function(e) {
          console.log(e)
          if(callback != undefined && typeof callback == "function" ){
            callback(_this.globalData.normalSkin);
          }
        }
    })
  }
})
